package br.edu.ufcg.lsd.wbis.ui.client.ui.management;

import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.event.PanelListenerAdapter;

/**
 * @author Renato Miceli
 */
public abstract class GenericInfoManager<T> extends PanelListenerAdapter implements InfoManager<T> {

	private T info;

	public GenericInfoManager(T info) {
		this.info = info;
	}

	/**
	 * {@inheritDoc}
	 */
	public T getInfo() {
		return info;
	}

	/**
	 * {@inheritDoc}
	 */
	public void setInfo(T info) {
		this.info = info;
	}

	public abstract void defaultSchedule();

	public abstract void defaultCancel();

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void onDestroy(Component component) {
		super.onDestroy(component);
		defaultCancel();
	}

}
